package com.zcxx.cotton.sale;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.StringUtils;
import com.zcxx.cotton.sale.domain.BuySaleinfosSample;
import com.zcxx.cotton.sale.service.IBuySaleinfosSampleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 籽棉交售子Controller
 *
 * @author ruoyi
 * @date 2025-07-28
 */
@RestController
@RequestMapping("/saleinfos/sample")
public class BuySaleinfosSampleController extends BaseController
{
    @Autowired
    private IBuySaleinfosSampleService buySaleinfosSampleService;

    /**
     * 查询籽棉交售子列表
     */
    @GetMapping("/list")
    public TableDataInfo list(BuySaleinfosSample saleinfosSample)
    {
        startPage();
        LambdaQueryWrapper<BuySaleinfosSample> queryWrapper=new LambdaQueryWrapper<>();
        if(StringUtils.isNotEmpty(saleinfosSample.getBillNoWeight())){
            queryWrapper.like(BuySaleinfosSample::getBillNoWeight,saleinfosSample.getBillNoWeight());
        }
        if(StringUtils.isNotEmpty(saleinfosSample.getSampleNumber())){
            queryWrapper.like(BuySaleinfosSample::getSampleNumber,saleinfosSample.getSampleNumber());
        }

        if(StringUtils.isNotEmpty(saleinfosSample.getStatusFlag())){
            queryWrapper.eq(BuySaleinfosSample::getStatusFlag,saleinfosSample.getStatusFlag());
        }

        if(StringUtils.isNotEmpty(saleinfosSample.getBeginTime()) && StringUtils.isNotEmpty(saleinfosSample.getEndTime())){
            queryWrapper.ge(BuySaleinfosSample::getCreateTime,saleinfosSample.getBeginTime());
            queryWrapper.le(BuySaleinfosSample::getCreateTime,saleinfosSample.getEndTime());
        }
        List<BuySaleinfosSample> list=buySaleinfosSampleService.list(queryWrapper);
        return getDataTable(list);
    }


}
